package leaern1;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author KongDehui
 * @description
 * @date 2023-04-18 09:20
 **/
public class Main {

    public static void main(String[] args) throws IOException {
        // 监听指定端口
        ServerSocket ss = new ServerSocket(8081);
        System.out.println("server is running...");
        for (; ;) {
            Socket sock = ss.accept();
            System.out.println("connected from " + sock.getRemoteSocketAddress());
            Thread t = new Handler(sock);
            t.start();
        }
    }

}
